project(imagetool)
cmake_minimum_required(VERSION 2.8)

if(NOT DEFINED TAR_TYPE)
    message(FATAL_ERROR "target tpye not defined, use -DTAR_TYPE=xxx to specify it!")
endif()
if(${TAR_TYPE} STREQUAL "3559")
    set(hisi_lib "lib/lib_3559")
    set(CMAKE_C_COMPILER "aarch64-himix100-linux-gcc")
    set(CMAKE_CXX_COMPILER "aarch64-himix100-linux-g++")
    
elseif(${TAR_TYPE} STREQUAL "3535")
    set(hisi_lib "lib/lib_3535")
    set(CMAKE_C_COMPILER "aarch64-himix200-linux-gcc")
    set(CMAKE_CXX_COMPILER "aarch64-himix200-linux-g++")
    
    
elseif(${TAR_TYPE} STREQUAL "3516")
    set(hisi_lib "lib/lib_3516")
    set(CMAKE_C_COMPILER "arm-himix200-linux-gcc")
    set(CMAKE_CXX_COMPILER "arm-himix200-linux-g++")
    add_definitions("-mfpu=neon-vfpv4 -mfloat-abi=softfp ")

elseif(${TAR_TYPE} STREQUAL "jetson")
    set(hisi_lib "lib/lib_jetson")
    set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
    set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
    
else()
    message(FATAL_ERROR "target tpye must be 3559,3516,3535,jetson, use -DTAR_TYPE=xxx to specify it!")
endif()

SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_EXE_LINKER_FLAGS "-lpthread -lrt -ldl")

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)

aux_source_directory(${PROJECT_SOURCE_DIR}/src SRCS)

add_executable(demo example/main.cpp ${SRCS})
